﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogicLayer;
using System.Collections;

namespace logicunivesityinventorystore.Store
{
    public partial class ManagePriority : System.Web.UI.Page
    {
        DepartmentFacade df = new DepartmentFacade();
        BusinessLogicLayer.Department department = new BusinessLogicLayer.Department();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                foreach (GridViewRow grRow in gvPriorityList.Rows)
                {

                    Label priorityID = grRow.FindControl("Label1") as Label;
                    DropDownList ddl = (DropDownList)grRow.FindControl("ddlPriority");
                    int select = Convert.ToInt32(priorityID.Text) - 1;
                    ddl.SelectedIndex = select;



                }
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            
                foreach (GridViewRow gvRow in gvPriorityList.Rows)
                {
                    Label departCode = (Label)gvRow.FindControl("lblDeptCode");
                    DropDownList ddl = (DropDownList)gvRow.FindControl("ddlPriority");
                    department.PriorityID = ddl.SelectedValue;
                    df.UpdatePriorityID(departCode.Text, ddl.SelectedValue);
                }
            
            Response.Redirect("HomePage_Store.aspx");
        }

        protected void btnClose_Click(object sender, EventArgs e)
        {
            
        }

      

      
       
    }
}